<%--
  Created by IntelliJ IDEA.
  User: bss
  Date: 2022/10/8
  Time: 21:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="/js/jquery-1.4.4.min.js"></script>
</head>
<body>

<input type="button" onclick="testGet()" value="get">
<input type="button" onclick="testPost()" value="post">
<input type="button" onclick="testPut()" value="put">
<input type="button" onclick="testDelete()" value="delete">
</body>
<script>
    function testGet() {
        $.ajax({
            type:"get",
            url:"/test/1",
            success:function (data) {
                console.log(data);
            }
        });
    }

    function testPost() {
        $.ajax({
            type:"post",
            url:"/test",
            contentType:'application/json',
            data:"{\"id\":2, \"name\":\"jiaxin\", \"sex\":\"男\",\"age\": 18}",
            success:function (data) {
                console.log(data);
            }
        });
    }

    function testPut() {
        $.ajax({
            type:"put",
            url:"/test",
            contentType:'application/json',
            data:"{\"id\":2, \"name\":\"jiaxin\", \"sex\":\"男\",\"age\": 18}",
            success:function (data) {
                console.log(data);
            }
        });
    }

    function testDelete() {
        $.ajax({
            type:"delete",
            url:"/test/1",
            success:function (data) {
                console.log(data);
            }
        });
    }
    
</script>
</html>
